<?php
namespace app\api\behavior;
use app\api\controller\Common;
use think\Request;

class Checkauth extends Common{
    public function run(&$params){
    	$token = Request::instance()->header('token');
        $timestamp = Request::instance()->header('timestamp');
        $uinfo = model("MemberToken")->check_token($token,$timestamp);
        if($uinfo !== false){
            $this->uinfo = $uinfo;
        }
        else{
            model("MemberToken")->delete_token($token);
            return $this->app_error("签名超时",401);
            exit();
        }
        return true;
    }
}